/**
 * Copyright (c) 2011 Duy Truong <hduyudh@gmail.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.anonymous.dobrochan.minoriko;

import org.anonymous.dobrochan.DobroConstants;
import org.w3c.dom.Element;

import android.content.Context;

public class Post {
    public int w, h;//, sample_w, sample_h, preview_w, preview_h;
    public String sample_url, file_url, preview_url;//, source;
    public String[] tags;
    public int id;//, parent_id;
    public String save_to;
    //public boolean bitmapIsSample = true;
    public boolean has_notes, has_comments;
    public int rating;
    //Context context;

    public Post(Context context, int width, int height, String sample_url, String preview_url, String file_url, String save_to)
            throws NumberFormatException, NullPointerException {
        w = width;
        h = height;
        id = 0;
        this.sample_url = urlCheck(context,sample_url);
        this.preview_url = urlCheck(context,preview_url);
        this.file_url = urlCheck(context,file_url);
        this.save_to = save_to;
        has_notes = false;
   		has_comments = false;
        rating = 1;
    }

    public long getId() {
        return this.id;
    }
    
    public String urlCheck(Context context, String url) {
        if (url.startsWith("http://")) {
            return url;
        } else {
            return DobroConstants.HOST + url;
        }
    }
}
